package com.neuedu.opp02ex;

public class HourlyEmployee extends ColaEmployee {
    /**
     * 每小时工资
     */
    private double hourSalary;
    /**
     * 工作时长
     */
    private int hour;

    public HourlyEmployee() {

    }

    public HourlyEmployee(String name, int birthMonth, double hourSalary, int hour) {
        super(name, birthMonth);
        this.hourSalary = hourSalary;
        this.hour = hour;
    }

    public int getHour() {
        return hour;
    }

    public void setHour(int hour) {
        this.hour = hour;
    }

    public double getHourSalary() {
        return hourSalary;
    }

    public void setHourSalary(double hourSalary) {
        this.hourSalary = hourSalary;
    }

    @Override
    public double getSalary(int month) {
        super.getSalary(month);
        if (hour > 160) {
            salary = 160 * this.hourSalary + (this.hour - 160) * 1.5 * this.hourSalary + salary;
        } else {
            salary = this.hour * this.hourSalary + salary;
        }
        return salary;
    }
}
